package com.yuanzong.wuliu.controller.app.business.customer;

import com.yuanzong.wuliu.common.vo.ApiResult;
import com.yuanzong.wuliu.controller.app.business.customer.param.AppBusinessCustomerBaodanAddParam;
import com.yuanzong.wuliu.controller.app.business.customer.param.AppBusinessCustomerBaodanEndParam;
import com.yuanzong.wuliu.controller.app.business.customer.param.AppBusinessCustomerBaodanPageParam;
import com.yuanzong.wuliu.service.app.business.customer.AppBusinessCustomerBaodanService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@RestController
@Api(tags = "app端 - 客户报单")
@RequestMapping("/app/business/customer/businessCustomerBaodan")
@Slf4j
public class AppBusinessCustomerBaodanController {

    @Autowired
    private AppBusinessCustomerBaodanService appBusinessCustomerBaodanService;

    @ApiOperation("分页")
    @RequestMapping(value = "/page", method = {RequestMethod.POST})
    public ApiResult page(@RequestBody AppBusinessCustomerBaodanPageParam param) throws Exception {
        ApiResult result = appBusinessCustomerBaodanService.page(param);
        return result;
    }

    @ApiOperation("添加")
    @RequestMapping(value = "/add", method = {RequestMethod.POST})
    public ApiResult add(@Valid @RequestBody AppBusinessCustomerBaodanAddParam param) throws Exception {
        ApiResult result = appBusinessCustomerBaodanService.add(param);
        return result;
    }

    @ApiOperation("结束")
    @RequestMapping(value = "/end", method = {RequestMethod.POST})
    public ApiResult end(@Valid @RequestBody AppBusinessCustomerBaodanEndParam param) throws Exception {
        ApiResult result = appBusinessCustomerBaodanService.end(param);
        return result;
    }

}
